# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libktorrent
pkgver=22.04.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# s390x and riscv64 blocked by polkit -> kio
arch="all !armhf !s390x !riscv64"
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
depends_dev="
	boost-dev
	gmp-dev
	karchive-dev
	kcrash-dev
	ki18n-dev
	kio-dev
	qca-dev
	qt5-qtbase-dev
	solid-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	samurai
	"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/libktorrent-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# utppolltest requires network access
	# superseedtest is broken
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "(utppoll|superseed)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3ea6530c62e1a022f8d679f9ed54654c3c468cfdd0aceff4b7f6e0a1687ec1ddf59aebcdc08a258d7a169f827ea0de4e8b5489df4225f4fb15988010bd0f4b99  libktorrent-22.04.3.tar.xz
"
